package managerSIP;

import java.io.IOException;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import net.sf.asterisk.manager.AuthenticationFailedException;
import net.sf.asterisk.manager.TimeoutException;


public class ManagerTest implements ManagerListener {

    private Manager myManagerSIP;
    private List<String> usersList = new ArrayList<String>();

    public ManagerTest(String hostname, String username,String password) throws NumberFormatException, IllegalArgumentException, IllegalStateException, InterruptedException, SQLException, IOException, AuthenticationFailedException, TimeoutException {
	myManagerSIP = new managerSIP.Manager(this, hostname, username, password);
	usersList.add("Ana");
	usersList.add("Maria");
	myManagerSIP.createSession("sessao", usersList);
	
	usersList.remove("Maria");
	myManagerSIP.createConference("sessao", usersList);
	
	usersList.add("Maria");
	usersList.remove("Ana");
	myManagerSIP.addUsersToConference("sessao", "Ana", usersList);
    }
    
    /**
     * @param args
     * @throws TimeoutException 
     * @throws AuthenticationFailedException 
     * @throws IOException 
     * @throws SQLException 
     * @throws InterruptedException 
     * @throws IllegalStateException 
     * @throws IllegalArgumentException 
     * @throws NumberFormatException 
     */
    public static void main(String[] args) throws NumberFormatException, IllegalArgumentException, IllegalStateException, InterruptedException, SQLException, IOException, AuthenticationFailedException, TimeoutException {
	new ManagerTest("malva.inf.ufsc.br", "maint", "password");   
    }


    @Override
    public void userJoinedConference(String sessionName, int conference,
	    String userID, String user) {
	// TODO Auto-generated method stub
	
    }

    @Override
    public void userJoinedSession(String session, String userID) {
	// TODO Auto-generated method stub
	
    }

    @Override
    public void userLeaveConference(String sessionName, int conference,
	    String userID, String user) {
	// TODO Auto-generated method stub
	
    }

    @Override
    public void userLeaveSession(String session, String userID) {
	// TODO Auto-generated method stub
	
    }

}
